Public Class MDBData
    Public Function Load_query(ByVal data_File As String, ByVal SQL As String) As DataSet
        Dim datas As New DataSet
        'Server=perfectserver; user=sa; password=23212; database=workstation
        'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Northwind.mdb
        datas = New System.Data.DataSet
        Dim connection As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & data_File)
        Dim adapter As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(SQL, connection)
        Dim table As System.Data.DataTable = New System.Data.DataTable("C")
        adapter.Fill(table)
        datas.Tables.Add(table)
        Return datas
    End Function

    Public Function Change_query(ByVal data_File As String, ByVal SQL As String) As String
        On Error GoTo err
        Dim Status As String
        Dim connection As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & data_File)
        Dim command As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand(sql, connection)
        connection.Open()
        command.ExecuteNonQuery()
        connection.Close()
        Status = "Ok"
        Return Status
        Exit Function
err:
        Status = "Error"
        Return Status
    End Function

    Public Function GetRowCount(ByVal data_File As String, ByVal SQL As String) As Long
        Dim datas As New DataSet
        'Server=perfectserver; user=sa; password=23212; database=workstation
        'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Northwind.mdb
        datas = New System.Data.DataSet
        Dim connection As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & data_File)
        Dim adapter As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(SQL, connection)
        Dim table As System.Data.DataTable = New System.Data.DataTable("C")
        adapter.Fill(table)
        datas.Tables.Add(table)
        Return datas.Tables("C").Rows.Count
    End Function

    Public Function GetDataInformation(ByVal data_File As String) As DataSet
        Dim datas As New DataSet
        'On Error GoTo err
        'Server=perfectserver; user=sa; password=23212; database=workstation
        'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Northwind.mdb
        datas = New System.Data.DataSet
        Dim connection As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & data_File)
        Dim adapter As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter("Select * from Dinfo", connection)
        Dim table As System.Data.DataTable = New System.Data.DataTable("C")
        adapter.Fill(table)
        datas.Tables.Add(table)
        Return datas
        Exit Function
Err:

    End Function

  
End Class

